<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../css/element.css">
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">

    <script src="../js/vue.js"></script>
    <script src="../js/element.js"></script>
    <script src="../js/axios.js"></script>
    <script src="../jss/requestjs.js"></script>
      <script src="../jss/admin-rule.js"></script>
      <script src="../js/jquery-3.5.1.min.js"></script>
      <script src="../lib/layui/layui.js" charset="utf-8"></script>
      <script src="../js/xadmin.js"></script>
      <script src="../js/md5.js"></script>
      <script src="../js/common.js"></script>

  </head>
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>导航元素88</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body" id="app">
      <xblock>
        <button class="layui-btn layui-btn-danger" ><i class="layui-icon"></i>批量删除</button>
          <button class="layui-btn" @click="addfunction"><i class="layui-icon"></i>新增菜单</button>
        <span class="x-right" style="line-height:40px">共有数据：{{pagination.total}} 条</span>
      </xblock>

      <el-table
              :data="tablefunction"
              style="width:100%"
              row-key="fid"
              border
              :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
        <el-table-column prop="fid" label="id" min-width="5%" align="center">
        </el-table-column>
        <el-table-column prop="name" label="权限名称" min-width="10%" align="center">
        </el-table-column>
        <el-table-column prop="operate" label="权限标识" min-width="10%" align="center">
        </el-table-column>
        <el-table-column prop="url" label="组件路径" min-width="10%" align="center">
        </el-table-column>
        <el-table-column prop="state" label="状态" min-width="10%" align="center">
          <template slot-scope="scope">
            <el-switch
                    v-model="scope.row.state==0"
                    @change="myswitch(scope.row)">
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column prop="type" label="权限类型" min-width="10%" align="center">
       <template slot-scope="scope">
            <el-button size="mini" type="success" icon="el-icon-s-operation" v-if="scope.row.type==10">菜单</el-button>
            <el-button size="mini" type="primary" icon="el-icon-connection" v-if="scope.row.type==20">按钮</el-button>
       </template>
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间" min-width="10%" align="center">
          <template slot-scope="scope">
            {{scope.row.createTime | mytime }}
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="15%" align="center">
          <template slot-scope="scope">
            <el-button plain size="mini" round v-if="scope.row.type==10" @click="addsubmodules(scope.row.fid,scope.row.name)">添加子模块</el-button>
            <el-button type="primary" icon="el-icon-edit" circle @click="updatefunctions(scope.row)"></el-button>
            <el-button type="danger" icon="el-icon-delete" circle @click="deletefunction(scope.row.fid,scope.row.name)"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <div>
        <el-pagination background layout="prev, pager, next,sizes,total" :total="pagination.total" :page-size="pagination.pageSize"
                       :current-page="pagination.pageNum" @size-change="sizeChange" @current-change="findBlogPageList" >
        </el-pagination>
      </div>


      <el-dialog
              title="修改状态"
              :visible.sync="statevalue"
              width="30%">
        <span>你确定要{{myfunction.values}} {{myfunction.name}} 这个权限吗?</span>
        <span slot="footer" class="dialog-footer">
    <el-button @click="statevalue = false">取 消</el-button>
    <el-button type="primary" @click="updatefunctionstate">确 定</el-button>
  </span>
      </el-dialog>


      <el-dialog title="菜单新增"
                 width="50%"
                 :visible.sync="addfunctionvalue">
        <span>
            <div class="layui-form-item" v-if="addsubmodulesvalue">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>功能名称
              </label>
              <div class="layui-input-inline">
                  <input type="text"  autocomplete="off" class="layui-input" v-model="addsubmodulesvaluename" disabled>
              </div>
          </div>
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>权限名称
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="username"  autocomplete="off" class="layui-input" v-model="sysfunction.name">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>权限标识
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="operate"  autocomplete="off" class="layui-input" v-model="sysfunction.operate">
              </div>
          </div>
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>组件路径
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="url"  autocomplete="off" class="layui-input" v-model="sysfunction.url">
              </div>
          </div>
        </span>
        <span slot="footer" class="dialog-footer">
    <el-button @click="addfunctionvalue = false">取 消</el-button>
    <el-button type="primary" @click="confirmaddfunction">新 增</el-button>
  </span>
      </el-dialog>



        <el-dialog title="菜单修改"
                   width="50%"
                   :visible.sync="updatesfunction">
        <span>
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>权限名称
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="username"  autocomplete="off" class="layui-input" v-model="updatevalueobj.name">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>权限标识
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="operate"  autocomplete="off" class="layui-input" v-model="updatevalueobj.operate">
              </div>
          </div>
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>组件路径
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="url"  autocomplete="off" class="layui-input" v-model="updatevalueobj.url">
              </div>
          </div>
             <div class="layui-form-item">
                    <el-switch
                            v-model="updatevalueobj.state==0"
                            active-text="已启用"
                            inactive-text="禁用"
                            @change="updatemyswitch()">
                    </el-switch>
           </div>
        </span>
            <span slot="footer" class="dialog-footer">
    <el-button @click="updatesfunction = false">取 消</el-button>
    <el-button type="primary" @click="confirmupdatefunction">修 改</el-button>
  </span>
        </el-dialog>


        <el-dialog
                title="删除管理"
                :visible.sync="deletevalue"
                width="30%">
            <span>你确定要删除{{deleteobj.name}}吗?</span>
            <span slot="footer" class="dialog-footer">
    <el-button @click="deletevalue = false">取 消</el-button>
    <el-button type="primary" @click="confirmdeletefun">确 定</el-button>
  </span>
        </el-dialog>





    </div>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>
  </body>

</html>